<?php
/**
 * Installer theme selector
 *
 * @copyright		The XOOPS project http://www.xoops.org/
 * @license			http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL)
 * @package			installer
 * @since			2.0.18
 * @version			$Id: page_theme.php 598 2006-06-30 15:45:20Z skalpa $
 *
 * @author			Haruki Setoyama  <haruki@planewave.org>
 * @author			Kazumi Ono <webmaster@myweb.ne.jp>
 * @author			Skalpa Keo <skalpa@xoops.org>
 * @author			dugris <dugris@frxoops.org>
**/

require_once 'common.inc.php';
if ( !defined('XOOPS_INSTALL') ) { die('XOOPS Custom Installation die'); }

$wizard->setPage( 'theme' );

require_once XOOPS_ROOT_PATH.'/class/database/databasefactory.php';
$xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection();
require_once '../kernel/object.php';
require_once '../class/criteria.php';
require_once '../include/functions.php';
require_once '../class/module.textsanitizer.php';

define("XOOPS_THEME_PATH", XOOPS_ROOT_PATH."/themes");

if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
	$config_handler = xoops_gethandler('config');
	if ( array_key_exists('conf_ids', $_REQUEST) ) {
		foreach ($_REQUEST['conf_ids'] as $key => $conf_id) {
			$config =& $config_handler->getConfig( $conf_id );
			$new_value = $_REQUEST[ $config->getVar('conf_name')] ;
			$config->setConfValueForInput($new_value);
			$config_handler->insertConfig($config);
		}
	}

	$member_handler =& xoops_gethandler('member');
	$member_handler->updateUsersByField('theme', $new_value );

	$wizard->redirectToPage( '+1' );
}

$wizard->loadConfigLangFile();
$wizard->loadThemeInfo();

$pageHasForm = true;
$pageHasHelp = false;

$content = $wizard->CreateForm();

include 'install_tpl.php';

?>